//
//  SocialVideoItemCell.m
//  ShowYork
//
//  Created by hxh on 2020/9/28.
//  Copyright © 2020 hxh. All rights reserved.
//

#import "SocialVideoItemCell.h"

@interface SocialVideoItemCell ()
@property (nonatomic,strong)UIImageView *imgView;
@property (nonatomic,strong)UIButton *coverBtn;
@end

@implementation SocialVideoItemCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUI];
    }
    return self;
}

- (void)setUI{
    self.imgView = [[UIImageView alloc]init];
    self.imgView.contentMode = UIViewContentModeScaleAspectFill;
    self.imgView.layer.masksToBounds = YES;
    [self.contentView addSubview:self.imgView];
    
    [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.bottom.equalTo(self.imgView);
    }];
    
    self.coverBtn = [[UIButton alloc]init];
    [self.coverBtn addTarget:self action:@selector(coverMethod) forControlEvents:UIControlEventTouchUpInside];
    [self.coverBtn setImage:[UIImage imageNamed:@"social_video"] forState:UIControlStateNormal];
    [self.coverBtn setImage:[UIImage imageNamed:@"social_video"] forState:UIControlStateHighlighted];
    [self.contentView addSubview:self.coverBtn];
    
    [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.bottom.equalTo(self.contentView);
    }];
    
    [self.coverBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.bottom.equalTo(self.contentView);
    }];
}
- (void)setVideoImg:(UIImage *)img{
    self.imgView.image = img;
}

- (void)coverMethod{
    if (self.delegate && [self.delegate respondsToSelector:@selector(showVideo)]) {
        [self.delegate showVideo];
    }
}

@end
